package me.landery.modules.sinco.service.impl;

import lombok.RequiredArgsConstructor;
import me.landery.modules.sinco.repository.ApplicationRepository;
import me.landery.modules.sinco.repository.CallRepository;
import me.landery.modules.sinco.repository.OrderRepository;
import me.landery.modules.sinco.repository.RechargeRepository;
import me.landery.modules.sinco.service.ApplicationService;
import me.landery.modules.sinco.service.CallService;
import me.landery.modules.sinco.service.DashboardService;
import me.landery.modules.system.repository.UserRepository;
import me.landery.modules.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author cc.w
 * @Date 2022/6/21 20:28
 * @Version 1.0
 */
@Service
@RequiredArgsConstructor
public class DashboardServiceImpl implements DashboardService {

    private final UserRepository userRepository;
    private final CallRepository callRepository;
    private final OrderRepository orderRepository;
    private final RechargeRepository rechargeRepository;
//    private ApplicationService appService;

    @Override
    public Map<String, Object> getAllPanelData() {
        Map<String, Object> dataMap = new HashMap<>();
        dataMap.put("user", userRepository.count());
        dataMap.put("call", callRepository.count());
        dataMap.put("order", orderRepository.count());
        dataMap.put("recharge", rechargeRepository.findAllBalance());
        return dataMap;
    }
}
